package window

type Iterator struct {
	count         int
	iteratorCount int
	bucket        *Bucket
}

func (i *Iterator) Next() bool {
	return i.iteratorCount < i.count
}

func (i *Iterator) Bucket() *Bucket {
	if i.iteratorCount >= i.count {
		panic("iteration out of range")
	}
	cur := i.bucket
	i.bucket = cur.Next
	i.iteratorCount++
	return cur
}
